{% extends "admin/index.html" %}
{% load i18n %}

{% block breadcrumbs %}
    <div id="breadcrumbs">
      <a href="/">{% trans 'Home' %}</a>{% if title %} &rsaquo; {{ title }}{% endif %}
      &rsaquo; <a href="../">{% trans 'My Tests' %}</a>  
      &rsaquo; Test
    </div>
{% endblock %}

{% block extrahead %}
    {% load adminmedia %}
    <script type="text/javascript" src="/admin/jsi18n/"></script>
    {{ test_form.media }}
{% endblock %}

{% block stylesheets %}
  {{ block.super }}
{% endblock %}

{% block javascripts %}
  {{ block.super }}
  <script type="text/javascript">
    function confirm_del() {
      if (confirm("Are you sure you want to delete?")){
        $('#test_form #hidden_del').click();
      }
    }
  </script>
{% endblock %}

{% block content %}
  <h1> Open Metric Recognition </h1>
  
  <h2>New Test</h2>
  {% if add and perms.omr.change_test %} <a href="{% url admin:omr_test_changelist %}">Start by copying existing test</a> {% endif %}
  <form enctype="multipart/form-data" action="" method="post" id="test_form">
    <fieldset class="module">
      <div class="row">
        {{ test_form.as_p }}
      </div>
    </fieldset>
    
    <div class="module footer"> 
      <ul class="submit-row">
          {% if add %}
            <li class="left delete-link-container"><a href="../" class="delete-link">Delete</a></li>
          {% else %}
            <li class="left delete-link-container"><a href="javascript:confirm_del()" rel="#conform_del" class="delete-link confirm">Delete</a></li>
          {% endif %}
          <li class="submit-button-container"><input type="submit" value="Save and continue to questions" class="default" name="_next" /></li>
          <li class="submit-button-container"><input type="submit" value="Save and continue editing" name="_continue" /></li>
          <li class="submit-button-container"><input type="submit" value="Save" name="_save" /></li>
          <input style="display:none;" id="hidden_del" type="submit" name="_delete" />
      </ul><br clear="all" /> 
    </div>
  </form>
{% endblock %}
